package com.lingz.manager.modules.base.controller.manage;

import com.alibaba.fastjson.JSONObject;
import com.lingz.manager.common.utils.RequestAuthorizationServiceUtil;
import com.lingz.manager.common.utils.ResultUtil;
import com.lingz.manager.common.vo.Result;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @auto wx
 * @description 请求认证服务
 * @date 2021/4/18
 */
@Slf4j
@RestController
@Api(description = "请求服务")
@RequestMapping("/EnjoyGIS/requestAuthorization")
@Transactional
public class RequestAuthorizationController {

    @RequestMapping("/list")
    public Result<Object> list(@RequestBody JSONObject jsonObject){
        String serviceUrl = jsonObject.getString("serviceUrl");
        JSONObject param = jsonObject.getJSONObject("param");
        String body = param.toJSONString();
        JSONObject result = RequestAuthorizationServiceUtil.requestService(serviceUrl, body);
        return new ResultUtil<Object>().setData(result);

    }


}
